#
# $Id: 950-dropbear 3561 2012-02-19 10:54:17Z pierre $
#
# Code taken from CLFS-Embedded
# Chapter 12 Beyond CLFS Embedded
#
# Dropbear is a relatively small SSH 2 server and client.
# Dropbear has a small memory footprint suitable for memory-constrained
# environments, while still having the same features as OpenSSH. It
# does not depend on OpenSSL and it has a MIT style license. Optionally
# it can even be made smaller.
#

PKG="DROPBEAR"
PKG_VERSION="0.48.1"
PKG_FILE="${PKG}-${PKG_VERSION}.tar.gz"
URL="http://matt.ucc.asn.au/dropbear/releases/${PKG_FILE}"
MD5="ca8e53a766faec831882831364568421"
for i in PATCH{1..10}; do
   unset $i
done
PATCH1="http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/dropbear-0.48.1-autotool-1.patch"

( cat << "xEOFx"

patch -Np1 -i ../dropbear-0.48.1-autotool-1.patch

cp Makefile.in{,.orig}
sed -e s/@LD@/@CC@/ Makefile.in.orig > Makefile.in

CC="${CC} ${BUILD}" ./configure --prefix=/usr --host=${CLFS_TARGET}

cp -v options.h options.h.backup
sed -e "s@/dev/random@/dev/urandom@" options.h.backup > options.h

make MULTI=1 PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"

make MULTI=1 PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install DESTDIR=${CLFS}
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/sbin/dropbear
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dbclient
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dropbearkey
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/dropbearconvert
ln -svf ../../usr/bin/dropbearmulti ${CLFS}/usr/bin/scp

install -dv ${CLFS}/etc/ssh


xEOFx
) > tmp
